interface Waiter_type {
  anjiao: boolean;
  say: () => {}
}

interface Teacher_type{
  anjiao: boolean;
  skill: () => {}
}

function judgeWho(animal: Waiter_type|Teacher_type){
  //  类型断言
  if(animal.anjiao){
    (animal as Teacher_type).skill()
  }else{
    (animal as Waiter_type).say()
  }
}

function judgeWhoTwo(animal: Waiter_type|Teacher_type){
  //  类型断言
  if('skill' in animal){
    animal.skill()
  }else{
    animal.say()
  }
}

function add(first: string| number, second: string|number){
  if(typeof first === 'string' || typeof second === 'string'){
    return `${first}${second}`
  }
  return first + second
}

class NumberObj{
  count!: number
}

function addObj(first: string| NumberObj, second: string|NumberObj){
  if(first instanceof NumberObj && second instanceof NumberObj){
    return first.count + second.count  
  }
  return 0
}